<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>项目问卷预览</title>
    <%@include file="../../common/includeBaseSet.jsp" %>
	<%@include file="../../common/includeSystemSet.jsp" %>
	<%@include file="../../common/operation_forbid.jsp" %>
	<%@include file="../../common/jsVersion.jsp" %>
    <link rel="stylesheet" href="${jypath}/resources/css/questionnaireStyle.css">
    <script src="${jypath}/resources/js/jQuery.print.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
    	.answer_ul{
			margin-left:40px
		}
    	.answer_li{
			float:left;
			list-style:none
		}
		a{cursor:pointer}
    </style>
</head>
<body>
	<div class="questionnaire color444" id="questionnaire">
	    <div class="page-nav">
	        <a href="javascript:void(0)" class="tab-nav  color444 active">${name }</a>
	<!--         <a href="javascript:void(0)" class="tab-nav color444">第二页</a> -->
	<!--         <a href="javascript:void(0)" class="tab-nav color444">第三页</a> -->
			<a onclick="backCustomer()" class="tab-nav color444" style="float:right" id="back">返回</a>
			<!-- a onclick="toEdit()" class="tab-nav color444" style="float:right" id="edit">编辑问卷</a -->
			<a onclick="print()" class="tab-nav color444" style="float:right" id="print">打印问卷</a>
	    </div>
	    <div class="tab-box">
	        <div class="qs-main" style="width:80%">
	<!--             <h2 class="qs-search font14px color444">客户关系管理资料卡333333</h2> -->
	            <ol id="main_ol" class="qs-list qs-relation font12px">
					<!-- 问卷内容 -->
		        </ol>
	        </div>
	    </div>
	    <div class="btn-list font12px text-center" style="display: none">
	        <a onclick="edit('1')" class="qs-btn-default color444">保存</a>
	        <a onclick="edit('2')" class="qs-btn-default color444">保存并关闭</a>
	        <a onclick="isConfirmBack()" class="qs-btn-default color444">退出</a>
	    </div>
	</div>
</body>
<script type="text/javascript" src="${jypath}/static/js/system/questionnaire/hisQuestionView.js"></script>
<script type="text/javascript" src="${jypath}/static/js/system/questionnaire/hisSaveAnswer.js"></script>
<script type="text/javascript">
	var isSubmit = false; //标识是否修改过问卷,用在离开问卷时，判断是否要保存
	$(function(){
		var url = "${jypath}/customer/customerProjectQuestion/questionList";
		loadQuestion(url, "${projectQuestionnaireId}", "${customerId}", "${customerPhone}");
		//判断是否修改过问卷
		$('#main_ol').on("blur", "input", function() {
			if($(this).attr("type") != "text"){
				isSubmit = true;
				return false;
			}
			if($(this).val() != ""){
				isSubmit = true;
			}
		});
	});
	//编辑
	function toEdit(){
		$(".btn-list").attr("style","");
		$("#print").attr("style", "float:right;display:none");
		$("#back").attr("style", "float:right;display:none");
		$("#edit").attr("style", "float:right;display:none");
	}
	//调用编辑答案的方法
	function edit(type){
		var url = "${jypath}/customer/customerAnswer/addOrUpdate";
		var projectId = "${projectId}";
		var customerId = "${customerId}";
		var projectQuestionnaireId = "${projectQuestionnaireId}";
		saveAnswer(type, url, projectQuestionnaireId, customerId, projectId, "e");
	}
	//返回列表
	function backCustomer(){
		location.href = jypath + "/customer/customerAnswer/index";
	}
</script>
</html>
